package exception;

import java.io.FileNotFoundException;

public class ThrowDemo {
    public static void main(String[] args) {
        Student zs=new Student();

        try {
            zs.setAge(110);
        } catch (IllegalAgeException e) {
            System.out.println(e.getMessage());//获取错误信息并输出
            e.printStackTrace();//打印输出错误信息

        }

        System.out.println("张三的年龄为"+zs.getAge()+"岁");
    }
}
